Re: [GENERAL] daily check for expired data ? - Mailing list pgsql-general

From Herouth Maoz
Subject Re: [GENERAL] daily check for expired data ?
Date
Msg-id l03110707b31169283e16@[147.233.159.109]
Whole thread Raw
In response to daily check for expired data ?  (Ralf Weidemann <Finc01@DX1.HRZ.Uni-Dortmund.DE>)
List pgsql-general
At 22:48 +0200 on 11/3/99, Ralf Weidemann wrote:


>
> how could I do an automatic daily check
> to delete some expired data ? I mean
> can I have a cron functionality in post-
> gresql ?

You don't need to have cron functionality in postgresql when you have cron
functionality in cron. :)

What you have to do is make a simple script, more or less like this:

#!/usr/bin/sh
PGHOST=...
PGPORT=...
PGUSER=...
psql my_database <<END_SQL
DELETE FROM table_in_question
WHERE datetime_field < ( 'now'::datetime - '1 day'::timespan );
END_SQL

And then run it with cron...

Herouth

--
Herouth Maoz, Internet developer.
Open University of Israel - Telem project
http://telem.openu.ac.il/~herutma



pgsql-general by date:

Previous
From: Henk Jan Barendregt
Date:
Subject: Error building pg 6.4 on RH Linux
Next
From: Klaas Talsma
Date:
Subject: unsubscribe pgsql-general